package com.hmall.api.interceptor;

import com.hmall.common.utils.UserContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;

public class FeignUserInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate template) {
        Long user = UserContext.getUser();
        if(user == null){
            return;
        }
        template.header("user-info", ""+user);
    }
}
